package com.dfqy.service;

import com.dfqy.dao.SymTypeDAO;
import com.dfqy.pojo.SymType;
import com.dfqy.vo.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SymTypeService {
    @Autowired
    private SymTypeDAO dao;

    public int add(SymType symType){
        int add = dao.add(symType);
        return add;
    }

    public int delete(long... id) {
        int delete = dao.delete(id);
        return delete;
    }

    public int update(SymType symType) {
        int update = dao.update(symType);
        return update;
    }

    public Page<SymType> paging(int pageNo, int pageSize, String symType,String poster) {
        List<SymType> list = dao.paging(pageNo, pageSize,symType,poster);
        int total=dao.findTotal(symType,poster);
        return new Page<>(list,pageNo,total,pageSize);
    }

    public SymType getInfoById(long id) {
        return dao.selectSymTypeById(id);
    }

    public boolean checktitle(String symType,long id) {
        return dao.checktitle(symType,id) > 0;
    }

    public boolean addchecktitle(String symType) {
        return dao.addchecktitle(symType) > 0;
    }
}
